import React from 'react';
import {
  GestureResponderEvent,
  StyleProp,
  Text,
  TouchableOpacity,
  ViewStyle,
} from 'react-native';

export interface ButtonType {
  style?: StyleProp<ViewStyle>;
  children?: Element | string;
  fontSize?: number;
  color?: string;
  disabled?: boolean;
  onPress?: (event: GestureResponderEvent) => void;
}
export default function Button(props: ButtonType) {
  const {style, onPress, fontSize, color, disabled, children} = props;
  return (
    <TouchableOpacity style={style} onPress={onPress} disabled={disabled}>
      {typeof children === 'string' ? (
        <Text style={{fontSize, color, lineHeight: fontSize}}>{children}</Text>
      ) : (
        children
      )}
    </TouchableOpacity>
  );
}
